x
base.BinaryExpression = base.AssignmentExpression = base.LogicalExpression = function(node, st, c) {// AST walker module for Mozilla Parser API compatible trees(function(mod) { if (typeof exports == "object" && typeof module == "object") return mod(exports); // CommonJS if (typeof define == "function" && define.amd) return define(["exports"], mod); // AMD mod((this.acorn || (this.acorn = {})).walk = {}); // Plain browser env})(function(exports) { "use strict"; // A simple walk is one where you simply specify callbacks to be // called on specific nodes. The last two arguments are optional. A // simple use would be // // walk.simple(myTree, { // Expression: function(node) { ... } // }); // // to do something with all expressions. All Parser API node types // can be used to identify node types, as well as Expression, // Statement, and ScopeBody, which denote categories of nodes. // // The base argument can be used to pass a custom (recursive) // walker, and state can be used to give this walked an initial // state. exports.simple = function(node, visitors, base, state) { if (!base) base = exports.base; function c(node, st, override) { var type = override || node.type, found = visitors[type]; base[type](node, st, c); if (found) found(node, st); } c(node, state); }; // An ancestor walk builds up an array of ancestor nodes (including // the current node) and passes them to the callback as the state parameter. exports.ancestor = function(node, visitors, base, state) { if (!base) base = exports.base; if (!state) state = []; function c(node, st, override) { var type = override || node.type, found = visitors[type]; if (node != st[st.length - 1]) { st = st.slice(); st.push(node); } base[type](node, st, c); if (found) found(node, st); } c(node, state); }; // A recursive walk is one where your functions override the default // walkers. They can modify and replace the state parameter that's // threaded through the walk, and can opt how and whether to walk // their child nodes (by calling their third argument on these // nodes). exports.recursive = function(node, state, funcs, base) {